function Engine(/*Vec2*/ size, /*Element*/ container){
	this.canvas = this.createCanvas(size, container);
	this.ctx = this.getCtx(this.canvas);
	
	this.images = [];
}

Engine.prototype.createCanvas = function(/*Vec2*/ size, /*Element*/ container){
	var canvas = document.createElement("canvas");
	
	canvas.width = size.a;
	canvas.height = size.b;
	
	container.appendChild(canvas);
	
	return canvas;
};

Engine.prototype.getCtx = function(/*Canvas*/ canvas){
	var ctx = canvas.getContext("2d");
	
	ctx.width = canvas.width;
	ctx.height = canvas.height;
	
	return ctx;
};

Engine.prototype.drawLine = function(/*Int*/ x1, /*Int*/ y1, /*Int*/ x2, /*Int*/ y2){
	this.ctx.beginPath();
	this.ctx.moveTo(x1, y1);
	this.ctx.lineTo(x2, y2);
	this.ctx.stroke();
};

Engine.prototype.loadImage = function(/*String*/ url){
	var img = new Image();
	
	img.src = url;
	img.ready = false;
	
	Utils.addEvent(img, "load", function(){
		img.ready = true;
	});
	
	this.images.push(img);
	return img;
};

Engine.prototype.areImagesReady = function(){
	for (var i=0,len=this.images.length;i<len;i++){
		if (!this.images[i].ready){
			return false;
		}
	}
	
	return true;
};
